package page6;

import java.util.Scanner;

public class Ques1347 {
	
	public void go(){
		Scanner scan = new Scanner(System.in);
		int i,Gi,j,t;
		int[] arr = new int[23];
		while(scan.hasNext()){
			i = scan.nextInt();
			Gi = scan.nextInt();
			j = scan.nextInt();
			t = 0;
			arr[1] = 1;
			arr[2] = 1;
			for(int k = 3;k < 23;k ++){
				arr[k] = arr[k - 1] + arr[k - 2];
			}
			if(i > 1){
				if((Gi - arr[i - 1]) % (arr[i-1] + arr[i-2])!=0){
					System.out.println(-1);
					continue;
				}
				t = (Gi - arr[i - 1]) / (arr[i-1] + arr[i-2]);
			}else if(i == 1){
				t = 1;
			}

			System.out.println("t:"+t);
			System.out.println(arr[j - 1] + arr[j] * t);
		}
	}
	
	public static void main(String[] args) {
		new Ques1347().go();
	}
}
